package com.yisen.proxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

public class DogProxy implements InvocationHandler {
    Animal animal;

    public DogProxy(Animal animal) {
        this.animal = animal;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println("dog 准备叫了");
        Object result = method.invoke(animal, args);
        System.out.println("dog 叫完了");
        return result;
    }

}
